<template>
    <div class="login-page">
      <h2 class="title">商家登录</h2>
  
      <van-form @submit="onSubmit">
        <van-field
          v-model="form.username"
          name="username"
          label=""
          placeholder="用户名"
          clearable
        />
        <van-field
          v-model="form.password"
          name="password"
          type="password"
          label=""
          placeholder="密码"
          clearable
        />
  
        <div style="margin: 24px 16px">
          <van-button round block type="primary" native-type="submit">
            确定
          </van-button>
        </div>
      </van-form>
  
      <div class="footer">
        还没有账户？<span class="register" @click="goToRegister">联系客服</span>
      </div>
    </div>
  </template>
  
  <script setup>
  import { reactive } from 'vue'
  import { showToast } from 'vant'
  
  const form = reactive({
    username: '',
    password: ''
  })
  
  const onSubmit = () => {
    if (!form.username || !form.password) {
      showToast('请输入完整信息')
      return
    }
    // 提交登录逻辑放这里
    showToast('登录中...')
  }
  
  const goToRegister = () => {
    // 跳转注册页面
    showToast('跳转注册')
  }
  </script>
  
  <style scoped>
  .login-page {
    padding: 40px 24px;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
  }
  .title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 30px;
  }
  .footer {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-top: 16px;
  }
  .register {
    color: #3b82f6;
    margin-left: 4px;
    cursor: pointer;
  }
  </style>